package com.phb.puhuibao.web.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.idp.pub.service.IBaseService;
import com.idp.pub.web.controller.BaseController;
import com.phb.puhuibao.entity.AliRefound;
import com.phb.puhuibao.entity.ZhifubaoTransfer;
import com.phb.puhuibao.service.AliRefoundService;

@Controller
@RequestMapping(value = "/aliRefound")
public class AliRefoundController extends BaseController<AliRefound, String> {
	
 
	
	@Resource(name = "aliRefoundService")
	public void setBaseService(IBaseService<AliRefound, String> baseService) {
		super.setBaseService(baseService);
	}
	
	@javax.annotation.Resource(name = "aliRefoundService")
	private AliRefoundService aliRefoundService;
	
	/**
	 * 完成提现
	 * @param muid
	 * @return
	 */
	@RequestMapping(value="finishRefound")
	@ResponseBody
	public Map<String, Object> finishRefound(@RequestParam String refoundId,@RequestParam int audituserid) {
		Map<String, Object> data = new HashMap<String, Object>();
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("refoundId", refoundId);
		AliRefound refound = this.getBaseService().unique(params);
 
		try {
			aliRefoundService.processFinnishRefound(refound, audituserid);
		    data.put("message", "退款成功!");
			data.put("status", 1);
			return data;
		} catch (Exception e) {
			data.put("message", "异常！");
			data.put("status", 0);
			return data;
		}
	}
	
  
  
	
	
}
